//
//  HQHttpManager.m
//  BeeServer
//
//  Created by ISU1 on 16/5/10.
//  Copyright © 2016年 HQ. All rights reserved.
// 网络管理类

#import "HQHttpManager.h"
#import <AFNetworking.h>

@implementation HQHttpManager
+ (NSMutableDictionary *)baseBody {
     NSMutableDictionary *body = [NSMutableDictionary dictionary];
    if (USERUID) {
      [body setObject:USERUID forKey:@"uid"];
    }
    return body;
}

+ (void)requestWihtMethod:(RequestMethodType)methodType
                      url:(NSString*)url
                   params:(NSDictionary*)params
                  success:(void (^)(id response))success
                  failure:(void (^)(NSError* err))failure
{
    NSURL* baseURL = [NSURL URLWithString:HttpUrlString];
    //获得请求管理者
    
    AFHTTPSessionManager* mgr = [[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];
//    [mgr.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
   
    mgr.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json",@"text/javascript", @"text/plain", nil];
    NSDictionary *newParams = [CodingTools signDataString:params];

    switch (methodType) {
        case RequestMethodTypeGet:
        {
            //GET请求
            [mgr GET:url
          parameters:newParams
            progress:^(NSProgress * _Nonnull downloadProgress) {
                
            }
             success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
                 if (success) {
                     
                     success(responseObject);
                 }
             }
             failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
                 if (failure) {
                     failure(error);
                 }
             }];
            
            
        }
            break;
        case RequestMethodTypePost:
        {
            //POST请求
            [mgr POST:url
           parameters:newParams
             progress:^(NSProgress * _Nonnull uploadProgress) {
                 
             }
              success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
                  if (success) {
                      success(responseObject);
                  }
              }
              failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
                  if (failure) {
                      failure(error);
                  }
              }];
        }
            break;
        default:
            break;
    }
}
#pragma mark 获取用户id
+ (NSString *)getUserId {
    if (nil != [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"uid"]) {
        return [NSString stringWithFormat:@"%@",[[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"uid"]] ;
    }else{
        return @"";
    }
}


#pragma mark 获取用户三方登录标志
+ (NSString *)getUserThirdNO {
    if (nil != [[NSUserDefaults standardUserDefaults] objectForKey:@"thirdNO"]) {
        return [NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"thirdNO"]] ;
    }else{
        return @"";
    }
}

#pragma mark 获取用户三方登录Type
+ (NSString *)getThirdType {
    if (nil != [[NSUserDefaults standardUserDefaults] objectForKey:@"thirdType"]) {
        return [NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"thirdType"]] ;
    }else{
        return @"";
    }
}

#pragma mark 获取融云用户id
+ (NSString *)getRCIMUserId {
    if (nil != [[NSUserDefaults standardUserDefaults] objectForKey:@"RCIMUserId"]) {
        return [NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"RCIMUserId"]];
    }else{
        return @"";
    }
}

#pragma mark 获取用户sex
+ (NSString *)getUserSex {
    if (nil != [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"sex"]) {
        return [NSString stringWithFormat:@"%@",[[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"sex"]];
    }else{
        return @"";
    }
}

#pragma mark 用户账号
+ (NSString *)userAccount {
    if (nil != [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"mobile"]) {
        return [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"mobile"];
    }else{
        return @"";
    }
}

#pragma mark 用户昵称
+ (NSString *)userNickName {
    if (nil != [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"nickName"]) {
        return [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"nickName"];
    }else{
        return @"";
    }
}

#pragma mark 用户密码
+ (NSString *)userPassword {
    if (nil != [[NSUserDefaults standardUserDefaults] objectForKey:@"password"]) {
        return [[NSUserDefaults standardUserDefaults] objectForKey:@"password"];
    }else{
        return @"";
    }
}

#pragma mark 获取用户Token
+ (NSString *)getUserToken {
    if (nil != [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"token"]) {
        return [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"token"];
    }else{
        return @"";
    }
}

#pragma mark 用户头像
+ (NSString *)userPhoto {
    if (nil != [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"photo"]) {
        return [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"photo"];
    }else{
   
        return @"";
    }
}

#pragma mark 用户头像
+ (NSString *)userBackground {
    if (nil != [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"background"]) {
        return [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"background"];
    }else{
        return @"";
    }
}
#pragma mark 用户生日
+ (NSString *)userBirthday{
    
    if (nil != [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"birthday"]) {
        return [[[NSUserDefaults standardUserDefaults] objectForKey:@"UserInformation"] objectForKey:@"birthday"];
    }else{
        return @"";
    }
    
}




+ (void)delAlbumWithAlbumId:(NSString *)albumId SuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"albumId":albumId};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/delAlbum"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"删除相册接口调用成功");
                 
                 successBlock (YES,@{@"code":response[@"code"]});
             } else {
                 NSLog(@"删除相册错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
//         NSLog(@"删除相册错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)putLocationWithUid:(NSString *)uid lon:(NSNumber *)lon lat:(NSNumber *)lat location:(NSString *)location successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"lon":lon,@"lat":lat,@"location":location};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"putLocation"
                     params:params
                    success:^(id response)
     {
         if (response) {
//             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 successBlock (YES,@{@"code":response[@"code"]});
             } else {
                 NSLog(@"上传位置错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
//         NSLog(@"上传位置错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  获取验证码
 *
 *  @param account     登录账号
 *  @param successBlock 成功回调
 */
+ (void)getCodeWithAccout:(NSString *)account type:(NSString *)type successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"mobile":account,@"type":type};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"common/getMobileCode"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 successBlock (YES,@{@"code":response[@"res"]});
             } else {
                 NSLog(@"获取验证码错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"获取验证码错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)resetPasswordWithMobile:(NSString *)mobile password:(NSString *)password successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"mobile":mobile,@"password":password};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"resetPassword"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"重置密码调用成功");
                 [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"mobile"];
                 [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"uid"];
                 [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"password"];
                 //删除数据
                 [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"UserInformation"];
                 successBlock (YES,response[@"res"]);
             } else {
                 NSLog(@"重置密码错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"重置密码错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  注册
 *
 *  @param account     登录账号
 *  @param password     登录密码
 *  @param successBlock 成功回调
 */
+ (void)registerWithAccout:(NSString *)account
                  password:(NSString *)password
              successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"mobile":account,@"password":password};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"reg"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"注册接口调用成功");
                 // 存入账号
                 [[NSUserDefaults standardUserDefaults] setValue:account forKey:@"mobile"];
                 [[NSUserDefaults standardUserDefaults] setValue:response[@"res"][@"uid"] forKey:@"uid"];
                 
                 //删除数据
                 [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"UserInformation"];
                 ///保存数据前先删除数据
                 [[NSUserDefaults standardUserDefaults] setObject:response[@"res"] forKey:@"UserInformation"];
                 [[NSUserDefaults standardUserDefaults] synchronize];
                 successBlock (YES,response[@"res"]);
             } else {
                 NSLog(@"登录错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"登录错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
    
}

/**
 *  礼物列表
 *
 *  @param successBlock 成功返回
 */
+ (void)giftListWithSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"page":@(1),@"rows":@(1000)};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"giftList"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"礼物列表接口调用成功");
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"礼物列表错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"礼物列表错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)addPraiseWithUid:(NSString *)uid circleId:(NSInteger)circleId trystId:(NSInteger)trystId type:(NSInteger)type successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"circleId":@(circleId),@"trystId":@(trystId),@"type":@(type)};
    if (circleId) {
        params = @{@"uid":uid,@"circleId":@(circleId),@"type":@(type)};
    }
    if (trystId) {
        params = @{@"uid":uid,@"trystId":@(trystId),@"type":@(type)};
    }
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/addPraise"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"动态点赞接口调用成功");
                 successBlock (YES,@{@"code":response[@"code"]});
             } else {
                 NSLog(@"动态点赞错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"动态点赞错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)delActiveWithUid:(NSString *)uid circleId:(NSInteger)circleId trystId:(NSInteger)trystId successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"circleId":@(circleId),@"trystId":@(trystId)};
    if (circleId) {
        params = @{@"uid":uid,@"circleId":@(circleId)};
    }
    if (trystId) {
        params = @{@"uid":uid,@"trystId":@(trystId)};
    }
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/delActive"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"删除动态接口调用成功");
                 successBlock (YES,@{@"code":response[@"code"]});
             } else {
                 NSLog(@"删除动态错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"删除动态错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)addJoinWithUid:(NSString *)uid trystId:(NSInteger)trystId successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"trystId":@(trystId)};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/addJoin"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"参加约会接口调用成功");
                 successBlock (YES,@{@"code":response[@"code"]});
             } else {
                 NSLog(@"参加约会错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"参加约会错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)updateJoinWithUid:(NSString *)uid trystId:(NSString *)trystId status:(NSInteger)status successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"trystId":trystId,@"status":@(status)};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/updateJoin"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"同意约会接口调用成功");
                 successBlock (YES,@{@"code":response[@"code"]});
             } else {
                 NSLog(@"同意约会错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"同意约会错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)joinStatusWithUid:(NSString *)uid trystId:(NSString *)trystId successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"trystId":trystId};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/joinStatus"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"赴约状态接口调用成功");
                 successBlock (YES,response[@"res"]);
             } else {
                 NSLog(@"赴约状态错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"赴约状态错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)addCommentWithUid:(NSString *)uid circleId:(NSInteger)circleId trystId:(NSInteger)trystId content:(NSString *)content successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"circleId":@(circleId),@"trystId":@(trystId),@"content":content};
    if (circleId) {
        params = @{@"uid":uid,@"circleId":@(circleId),@"content":content};
    }
    if (trystId) {
        params = @{@"uid":uid,@"trystId":@(trystId),@"content":content};
    }
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/addComment"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"评论动态接口调用成功");
                 successBlock (YES,@{@"code":response[@"code"]});
             } else {
                 NSLog(@"评论动态错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"评论动态错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)userInfo2WithUid:(NSString *)uid successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"userInfo"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"个人信息接口调用成功");
                 [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"UserInformation"];
                 ///保存数据前先删除数据
                 [[NSUserDefaults standardUserDefaults] setObject:response[@"res"] forKey:@"UserInformation"];
                 
                 [[NSUserDefaults standardUserDefaults] synchronize];

                 
                 successBlock (YES,response[@"res"]);
             } else {
                 NSLog(@"个人信息错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"个人信息错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  登录
 *
 *  @param account     登录账号
 *  @param password     登录密码
 *  @param successBlock 成功回调
 */
+ (void)userLoginWithAccout:(NSString *)account
                   password:(NSString *)password
                    thirdNO:(NSString *)thirdNO
                  thirdType:(NSString *)thirdType
                       mode:(NSString *)mode
                   nickName:(NSString *)nickName
                   deviceNo:(NSString *)deviceNo
               successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{};
    
    if (thirdNO.length) {
        params = @{@"thirdNo":thirdNO,@"thirdType":thirdType,@"nickName":nickName,@"mode":mode,@"deviceNo":deviceNo};
    } else {
        params = @{@"mobile":account,@"password":password,@"mode":mode,@"deviceNo":deviceNo};
    }
    
    
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"login"
                     params:params
                    success:^(id response)
    {
        if (response) {
            NSLog(@"res%@",response);
            NSNumber *ok = response[@"ok"];
            if (![ok isEqual:@0]) {
                

                NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
                
                // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
                
                [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
                
                //现在时间,你可以输出来看下是什么格式
                
                NSDate *datenow = [NSDate date];
                
                //----------将nsdate按formatter格式转成nsstring
                
                NSString *currentTimeString = [formatter stringFromDate:datenow];
                
                [defaults setValue:currentTimeString forKey:@"loginTime"];
                
                NSLog(@"currentTimeString =  %@",currentTimeString);
                

                // 存入账号
                [[NSUserDefaults standardUserDefaults] setValue:account forKey:@"mobile"];
                [[NSUserDefaults standardUserDefaults] setValue:password forKey:@"password"];
                [[NSUserDefaults standardUserDefaults] setValue:thirdNO forKey:@"thirdNO"];
                [[NSUserDefaults standardUserDefaults] setValue:thirdType forKey:@"thirdType"];
                [[NSUserDefaults standardUserDefaults] setValue:response[@"res"][@"uid"] forKey:@"uid"];
                [[NSUserDefaults standardUserDefaults] setValue:response[@"res"][@"sex"] forKey:@"sex"];
                
                [defaults setValue:response[@"res"][@"infoStatus"] forKey:@"infoStatus"];
                
                [defaults setObject:@"1" forKey:@"isFirstComeIn"];
                
                
                [defaults setValue:response[@"res"][@"tlsSig"] forKey:@"cheekVodepSig"];

                //删除数据
                [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"UserInformation"];
                ///保存数据前先删除数据
                [[NSUserDefaults standardUserDefaults] setObject:response[@"res"] forKey:@"UserInformation"];
                
                [[NSUserDefaults standardUserDefaults] synchronize];
                NSLog(@"服务器账号登录成功");

                successBlock (YES,response[@"res"]);
            } else {
                NSLog(@"登录错误返回:%@",response[@"message"]);
                [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                successBlock (NO,nil);
            }
        }
    }
                    failure:^(NSError *err)
    {
        
        NSLog(@"登录错误返回:%@",err.description);
        [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
        successBlock (NO,nil);
    }];
    
}




/**
 *  批量校验手机号
 *
 *  @param mobile       手机号
 *  @param uid          uid
 *  @param successBlock 成功返回
 */
+ (void)checkMobilesWithMobile:(NSArray *)mobile uid:(NSString *)uid successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSString *mobileString = [mobile componentsJoinedByString:@","];
    mobileString=[mobileString stringByReplacingOccurrencesOfString:@"-"withString:@""];
    mobileString=[mobileString stringByReplacingOccurrencesOfString:@"+86"withString:@""];
    mobileString=[mobileString stringByReplacingOccurrencesOfString:@" "withString:@""];
    NSDictionary *params = @{@"mobile":mobileString,@"uid":uid};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"checkMobiles"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"批量校验手机号接口调用成功");
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"批量校验手机号错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"批量校验手机号错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)helloWithUid:(NSString *)uid wid:(NSNumber *)wid mobile:(NSString *)mobile successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{};
    if (wid) {
        params = @{@"uid":uid,@"wid":wid};
    }
    if (mobile) {
        params = @{@"uid":uid,@"mobile":mobile};
    }
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"hello"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"申请好友接口调用成功");
                 successBlock (YES,@{@"res":response[@"code"]});
             } else {
                 NSLog(@"申请好友错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"申请好友错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  群组列表
 *
 *  @param uid          uid
 *  @param successBlock 成功返回
 */
+ (void)myGroupListWithUid:(NSString *)uid successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"page":@(1),@"rows":@(1000)};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"myGroupList"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"群组列表接口调用成功");
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"群组列表错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"群组列表错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)addTrystWithUid:(NSString *)uid trystType:(NSNumber *)trystType thirdNo:(NSString *)thirdNo trystPlace:(NSString *)trystPlace funName:(NSString *)funName trystTime:(NSString *)trystTime hopeSex:(NSNumber *)hopeSex whoPay:(NSNumber *)whoPay howArrive:(NSNumber *)howArrive hopeNote:(NSString *)hopeNote img:(NSString *)img location:(NSString *)location seeType:(NSNumber *)seeType somebody:(NSString *)somebody remind:(NSString *)remind SuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSMutableDictionary *params = @{@"uid":uid,@"trystType":trystType,@"trystPlace":trystPlace,@"trystTime":trystTime,@"seeType":seeType}.mutableCopy;
    if (thirdNo) {
        [params setObject:thirdNo forKey:@"thirdNo"];
    }
    if (funName) {
        [params setObject:funName forKey:@"funName"];
    }
    if (hopeSex) {
        [params setObject:hopeSex forKey:@"hopeSex"];
    }
    if (whoPay) {
        [params setObject:whoPay forKey:@"whoPay"];
    }
    if (howArrive) {
        [params setObject:howArrive forKey:@"howArrive"];
    }
    if (hopeNote) {
        [params setObject:hopeNote forKey:@"hopeNote"];
    }
    if (img) {
        [params setObject:img forKey:@"img"];
    }
    if (location) {
        [params setObject:location forKey:@"location"];
    }
    if (somebody) {
        [params setObject:somebody forKey:@"somebody"];
    }
    if(remind){
        [params setObject:remind forKey:@"remind"];
    }
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/addTryst"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"发布邀约接口调用成功");
                 // 存入账号
                 successBlock (YES,response[@"res"]);
             } else {
                 NSLog(@"发布邀约错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"发布邀约错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  添加话题讨论
 *
 *  @param uid          uid
 *  @param topicId      话题id
 *  @param img          imgUrl
 *  @param successBlock 成功返回
 */
+ (void)addTalkWithUid:(NSString *)uid topicId:(NSNumber *)topicId img:(NSString *)img successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"topicId":topicId,@"img":img};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"topic/addTalk"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"添加话题讨论接口调用成功");
                 successBlock (YES,@{@"res":response[@"code"]});
             } else {
                 NSLog(@"添加话题讨论错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         NSLog(@"添加话题讨论错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  2.2.5.	个人信息设置
 *
 *  @param uid          用户编号
 *  @param mobile       手机号
 *  @param photo        头像
 *  @param motto        个性签名
 *  @param sex          性别
 *  @param nickName     昵称
 *  @param birthday     生日
 *  @param animal       生肖
 *  @param height       身高
 *  @param weight       体重
 *  @param affection    感情状况
 *  @param email        email
 *  @param job          职业
 *  @param hometown     家乡/来自哪里
 *  @param activeSite   经常出没/活跃地点
 *  @param skill        擅长技能
 *  @param wantSkill    想学技能
 *  @param zfb          支付宝账号
 *  @param zfbName      支付宝姓名
 *  @param successBlock 成功回调
 */

+ (void)updateUserWithUid:(NSString *)uid
                   mobile:(NSString *)mobile
                    photo:(NSString *)photo
                    motto:(NSString *)motto
                      sex:(NSNumber *)sex
                 nickName:(NSString *)nickName
                 birthday:(NSString *)birthday
                   animal:(NSString *)animal
                   height:(NSString *)height
                   weight:(NSString *)weight
                affection:(NSString *)affection
                    email:(NSString *)email
                      job:(NSString *)job
                 hometown:(NSString *)hometown
               activeSite:(NSString *)activeSite
                    skill:(NSString *)skill
                wantSkill:(NSString *)wantSkill
                      zfb:(NSString *)zfb
                  zfbName:(NSString *)zfbName
                  cardImg:(NSString *)cardImg
                    video:(NSString *)video
                  privacy:(NSNumber *)privacy
                 isShield:(NSNumber *)isShield
             successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSMutableDictionary *params = @{@"uid":[HQHttpManager getUserId]}.mutableCopy;
    if (mobile) {
        [params setObject:mobile forKey:@"mobile"];
    }
    if (photo) {
        [params setObject:photo forKey:@"photo"];
    }
    if (motto) {
        [params setObject:motto forKey:@"motto"];
    }
    if (sex) {
        [params setObject:sex forKey:@"sex"];
    }
    if (nickName) {
        [params setObject:nickName forKey:@"nickName"];
    }
    if (animal) {
        [params setObject:animal forKey:@"animal"];
    }
    if (height) {
        [params setObject:height forKey:@"height"];
    }
    if (weight) {
        [params setObject:weight forKey:@"weight"];
    }
    if (affection) {
        [params setObject:affection forKey:@"affection"];
    }
    if (email) {
        [params setObject:email forKey:@"email"];
    }
    if (job) {
        [params setObject:job forKey:@"job"];
    }
    if (hometown) {
        [params setObject:hometown forKey:@"hometown"];
    }
    if (activeSite) {
        [params setObject:activeSite forKey:@"activeSite"];
    }
    if (skill) {
        [params setObject:skill forKey:@"skill"];
    }
    if (wantSkill) {
        [params setObject:wantSkill forKey:@"wantSkill"];
    }
    if (zfb) {
        [params setObject:zfb forKey:@"zfb"];
    }
    if (zfbName) {
        [params setObject:zfbName forKey:@"zfbName"];
    }
    if (birthday) {
        [params setObject:birthday forKey:@"birthday"];
    }
    if (cardImg) {
        [params setObject:cardImg forKey:@"cardImg"];
    }
    if (video) {
        [params setObject:video forKey:@"video"];
    }
    if (privacy) {
        [params setObject:privacy forKey:@"privacy"];
    }
    if (isShield) {
        [params setObject:isShield forKey:@"isShield"];
    }
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"updateUser"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"个人信息设置接口调用成功");
                 // 存入账号
                 successBlock (YES,response[@"res"]);
             } else {
                 NSLog(@"个人信息设置错误返回:%@",response[@"message"]);
                 [SVProgressHUD showInfoWithStatus:response[@"message"]];
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                   [SVProgressHUD dismiss];
                 });
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"个人信息设置错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}
/**
 *  上传图片
 *
 *  @param image        图片
 *  @param belong       文件夹
 *  @param toAlbum      是否为上传到相册
 *  @param albumId      相册id
 *  @param successBlock 成功回调
 */
+ (void)uploadimgsWithImage:(UIImage *)image belong:(NSString *)belong toAlbum:(NSNumber *)toAlbum albumId:(NSNumber *)albumId successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSMutableDictionary *params = @{@"belong":belong,@"toAlbum":toAlbum}.mutableCopy;
    if ([toAlbum isEqualToNumber:@1]) {
        [params setObject:albumId forKey:@"albumId"];
    }
    NSData *imageData = UIImageJPEGRepresentation(image, 1);
    float length = [imageData length]/1000;
    float scale = 0.0f;
    if (length > 150) {
        scale = 150.0f /length;
    }else{
        scale = 1.0f;
    }
    
    NSData *fData = UIImageJPEGRepresentation(image, scale);
    NSURL* baseURL = [NSURL URLWithString:HttpUrlString];
    //获得请求管理者
    NSDictionary *newParams = [CodingTools signDataString:params];
    
    AFHTTPSessionManager* mgr = [[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];
    
    mgr.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json",@"text/javascript", @"text/plain", nil];
    [mgr     POST:@"common/uploadFile"
       parameters:newParams
constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData)
     {
         [formData appendPartWithFileData:fData name:@"file" fileName:@"image" mimeType:@"image/jpeg"];
     }
         progress:^(NSProgress * _Nonnull uploadProgress)
     {
         
     }
          success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject)
     {
         NSNumber *ok = responseObject[@"ok"];
         if (![ok isEqual:@0]) {
             NSLog(@"图片上传：%@",responseObject);
             //NSString *url = responseObject[@"res"];
            // successBlock(YES,@{@"res":[kImgUrlString stringByAppendingString:url]});
             successBlock(YES,responseObject);
         } else {
             NSLog(@"图片上传错误返回%@",responseObject[@"message"]);
             successBlock(NO,nil);
         }
         
     }
          failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error)
     {
         NSLog(@"图片上传失败%@",error.description);
         if (successBlock) {
             successBlock(NO,nil);
         }
     }];
}


/**
 *  闪约宝贝详情
 *
 *  @param uid          uid
 *  @param myId         myId
 *  @param successBlock 成功返回
 */
+ (void)sInfoWithUid:(NSString *)uid myId:(NSString *)myId successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"myId":myId};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"sInfo"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"闪约宝贝详情接口调用成功");
                 successBlock (YES,response[@"res"]);
             } else {
                 NSLog(@"闪约宝贝详情错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"闪约宝贝详情错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)mfWithUid:(NSString *)uid successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/mf"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"动态首页接口调用成功");
                 successBlock (YES,response[@"res"]);
             } else {
                 NSLog(@"动态首页错误返回:%@",response[@"message"]);
//                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"动态首页错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)mfWithCount:(NSString *)uid
       successBlock: (void(^)(BOOL isSuccess, NSDictionary *resultDic))successBlock{
    
    NSDictionary *params = @{@"uid":uid};

    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/mfCount"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"动态首页接口调用成功");
                 successBlock (YES,response[@"res"]);
             } else {
                 NSLog(@"动态首页错误返回:%@",response[@"message"]);
//                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"动态首页错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];

}



/**
 *  谁喜欢我
 *
 *  @param uid          uid
 *  @param lon          经度
 *  @param lat          纬度
 *  @param page         页数
 *  @param successBlock 成功返回
 */
+ (void)getwhoWooMeListWithUid:(NSString *)uid
                           lon:(NSNumber *)lon
                           lat:(NSNumber *)lat
                          page:(NSNumber *)page
                  successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"lon":lon,@"lat":lat,@"page":page,@"rows":@(10)};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"whoWooMeList"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"谁喜欢我接口调用成功");
                 // 存入账号
                 //NSArray *res = [HRLikeMeModel parse:response[@"res"]];
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"谁喜欢我错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"谁喜欢我错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  喜欢处理
 *
 *  @param uid          uid
 *  @param wid          wid
 *  @param successBlock 成功返回
 */
+ (void)pickWooWithUid:(NSString *)uid
                   wid:(NSNumber *)wid
                  type:(NSNumber *)type
          successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"wid":wid,@"type":type};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"pickWoo"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"喜欢处理接口调用成功");
                 successBlock (YES,@{@"res":response[@"code"]});
             } else {
                 NSLog(@"喜欢处理错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"喜欢处理错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  清空喜欢
 *
 *  @param uid          uid
 *  @param successBlock 成功返回
 */
+ (void)emptyWooWithUid:(NSString *)uid
           successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"emptyWoo"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"清空喜欢接口调用成功");
                 successBlock (YES,@{@"res":response[@"code"]});
             } else {
                 NSLog(@"清空喜欢错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"清空喜欢错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}


/**
 *  查看问题
 *
 *  @param uid          uid
 *  @param wid          wid
 *  @param askId        askId
 *  @param successBlock 成功返回
 */
+ (void)getAskByIdWithUid:(NSString *)uid
                      wid:(NSNumber *)wid
                    askId:(NSNumber *)askId
               userGiftId:(NSNumber *)userGiftId
             successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"wid":wid,@"askId":askId,@"userGiftId":userGiftId};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"getAskById"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"查看问题接口调用成功");
                 successBlock (YES,@{@"res":response[@"code"]});
             } else {
                 NSLog(@"查看问题错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"查看问题错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  领取礼物
 *
 *  @param userGiftId   礼物Id
 *  @param successBlock 成功返回
 */
+ (void)receiveGiftWithUserGiftId:(NSString *)userGiftId
                     successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{
                             @"userGiftId":userGiftId
                             };
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"receiveGift"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"领取礼物接口调用成功");
                 successBlock (YES,@{@"res":response[@"code"]});
             } else {
                 NSLog(@"领取礼物错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"领取礼物错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  好友列表
 *
 *  @param uid          uid
 *  @param successBlock 成功返回
 */
+ (void)myFriendListWithUserid:(NSString *)uid successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"page":@1,@"rows":@(10000)};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"myFriendList"
                     params:params
                    success:^(id response)
     {
         if (response) {
//             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"好友列表接口调用成功");
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"好友列表错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"好友列表错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  删除好友
 *
 *  @param uid          uid
 *  @param successBlock 成功返回
 */
+ (void)deleteFriendListWithUserid:(NSString *)uid andWid:(NSString *)wid successBlock:(void (^)(BOOL isSuccess, NSDictionary *resultDic))successBlock {
    NSDictionary *params = @{@"uid":uid,@"wid":wid};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"delFriend"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"删除好友接口调用成功");
                 successBlock (YES,nil);
             } else {
                 NSLog(@"删除好友错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"好友列表错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}



/**
 *  新的好友
 *
 *  @param uid          uid
 *  @param successBlock 成功返回
 */
+ (void)myNewFriendListWithUid:(NSString *)uid
                          page:(NSNumber *)page
                  successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"page":page,@"rows":@(20)};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"myNewFriendList"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"新的好友接口调用成功");
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"新的好友错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"新的好友错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  接受申请
 *
 *  @param uid          uid
 *  @param wid          wid
 *  @param successBlock 成功返回
 */
+ (void)acceptWithUid:(NSString *)uid
                  wid:(NSNumber *)wid
         successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"wid":wid};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"accept"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"接受申请接口调用成功");
                 successBlock (YES,@{@"res":response[@"code"]});
             } else {
                 NSLog(@"接受申请错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"接受申请错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)myBlackListWithUid:(NSString *)uid page:(NSNumber *)page successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"page":page,@"rows":@(10)};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"myBlackList"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"黑名单接口调用成功");
                 
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"黑名单错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"黑名单错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

+ (void)reBlackFriendWithUid:(NSString *)uid wid:(NSNumber *)wid successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"wid":wid};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"reBlackFriend"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"恢复拉黑接口调用成功");
                 
                 successBlock (YES,@{@"code":response[@"code"]});
             } else {
                 NSLog(@"恢复拉黑错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"恢复拉黑错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  话题轮播图
 *
 *  @param uid          uid
 *  @param successBlock 成功返回
 */
+ (void)topicScrollPictureWithUid:(NSString *)uid
                     successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"topic/imgs"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"话题轮播图接口调用成功");
                 
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"话题轮播图错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"话题轮播图错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  朋友圈
 *
 *  @param uid          uid
 *  @param herId        herId
 *  @param page         page
 *  @param successBlock 成功返回
 */
+ (void)activeListWithUid:(NSString *)uid
                    herId:(NSString *)herId
                     page:(NSNumber *)page
             successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{};
    if (herId == nil||herId.length == 0) {
        params = @{@"uid":uid,@"page":page,@"rows":@(10)};
    } else {
        params = @{@"uid":uid,@"herId":herId,@"page":page,@"rows":@(10)};
    }
  
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/activeList"
                     params:params
                    success:^(id response)
     {
         if (response) {
//             NSLog(@"陌生人朋友圈朋友圈接口调用成功res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"朋友圈接口调用成功");
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"朋友圈错误返回:%@",response[@"message"]);
                 //[[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
//                 [SVProgressHUD showInfoWithStatus:response[@"message"]];
                 successBlock (NO,response);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"朋友圈错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}
//朋友圈回复消息点击请求详情
+(void)FriendNewhistoryCircleId:(NSString *)circleId
                   successBlock:(void(^)(BOOL isSuccess, NSDictionary *resultDic))successBlock{
    NSDictionary *params = @{@"circleId":circleId};

    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/activeById"
                     params:params
                    success:^(id response)
     {
         if (response) {
             //             NSLog(@"陌生人朋友圈朋友圈接口调用成功res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"朋友圈接口调用成功");
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"朋友圈错误返回:%@",response[@"message"]);
                 //[[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 //                 [SVProgressHUD showInfoWithStatus:response[@"message"]];
                 successBlock (NO,response);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"朋友圈错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];

}

/**
 *  创建话题
 *
 *  @param uid          uid
 *  @param topicType    话题类型
 *  @param topicName    话题名称
 *  @param topicNote    话题简介
 *  @param isReward     是否悬赏
 *  @param endTime      结束时间
 *  @param successBlock 成功返回
 */
+ (void)addTopicWithUid:(NSString *)uid topicType:(NSNumber *)topicType topicName:(NSString *)topicName topicNote:(NSString *)topicNote isReward:(NSNumber *)isReward endTime:(NSString *)endTime successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"uid":uid,@"topicType":topicType,@"topicName":topicName,@"topicNote":topicNote,@"isReward":isReward,@"endTime":endTime};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"topic/addTopic"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"创建话题接口调用成功");
                 successBlock (YES,@{@"res":response[@"code"]});
             } else {
                 NSLog(@"创建话题错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"创建话题错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  话题列表
 *
 *  @param topicType    话题类型
 *  @param page         page
 *  @param successBlock 成功返回
 */
+ (void)topicListWithTopicType:(NSNumber *)topicType page:(NSNumber *)page successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{};
    if ([topicType isEqualToNumber:@(0)]) {
        params = @{@"page":page,@"rows":@(10)};
    } else {
        params = @{@"topicType":topicType,@"page":page,@"rows":@(10)};
    }
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"topic/topicList"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"话题列表接口调用成功");
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"话题列表错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"话题列表错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  话题讨论列表
 *
 *  @param topicId      话题Id
 *  @param sort         排序 1、最新正序 2、最热正序
 *  @param page         page
 *  @param successBlock 成功返回
 */
+ (void)talkListWithTopicId:(NSNumber *)topicId sort:(NSNumber *)sort page:(NSNumber *)page successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"topicId":topicId,@"sort":sort,@"page":page,@"rows":@(10)};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"topic/talkList"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"话题讨论列表接口调用成功");
                 successBlock (YES,@{@"res":response[@"res"]});
             } else {
                 NSLog(@"话题讨论列表错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"话题讨论列表错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  点赞
 *
 *  @param talkId       talkId
 *  @param uid          uid
 *  @param successBlock 成功返回
 */
+ (void)addPraiseWithTalkId:(NSNumber *)talkId uid:(NSString *)uid successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"talkId":talkId,@"uid":uid};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"topic/addPraise"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"点赞接口调用成功");
                 successBlock (YES,@{@"res":response[@"code"]});
             } else {
                 NSLog(@"点赞错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"点赞错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  评论讨论
 *
 *  @param talkId       talkId
 *  @param content      内容
 *  @param uid          uid
 *  @param successBlock 成功返回
 */
+ (void)addCommentWithTalkId:(NSNumber *)talkId content:(NSString *)content uid:(NSString *)uid successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"talkId":talkId,@"content":content,@"uid":uid};
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"topic/addComment"
                     params:params
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"评论讨论接口调用成功");
                 successBlock (YES,@{@"res":response[@"code"]});
             } else {
                 NSLog(@"评论讨论错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"评论讨论错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

/**
 *  评论列表
 *
 *  @param talkId       讨论Id
 *  @param page         page
 *  @param successBlock 成功返回
 */
+ (void)commentListWithTalkId:(NSNumber *)talkId page:(NSNumber *)page successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
        NSDictionary *params = @{@"talkId":talkId,@"page":page,@"rows":@(20)};
        [self requestWihtMethod:RequestMethodTypePost
                            url:@"topic/commentList"
                         params:params
                        success:^(id response)
         {
             if (response) {
                 NSLog(@"res%@",response);
                 NSNumber *ok = response[@"ok"];
                 if (![ok isEqual:@0]) {
                     NSLog(@"评论列表接口调用成功");
                     successBlock (YES,@{@"res":response[@"res"]});
                 } else {
                     NSLog(@"评论列表错误返回:%@",response[@"message"]);
                     [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                     successBlock (NO,nil);
                 }
             }
         }
                        failure:^(NSError *err)
         {
             
             NSLog(@"评论列表错误返回:%@",err.description);
             [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
             successBlock (NO,nil);
         }];
}

+ (void)outTrystWithTrystId:(NSInteger)trystId SuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary  *dic = @{
                           @"uid":[HQHttpManager getUserId],
                           @"trystId":@(trystId)
                           };
    [self requestWihtMethod:RequestMethodTypePost
                        url:@"active/outTryst"
                     params:dic
                    success:^(id response)
     {
         if (response) {
             NSLog(@"res%@",response);
             NSNumber *ok = response[@"ok"];
             if (![ok isEqual:@0]) {
                 NSLog(@"退出约会接口调用成功");
                 successBlock (YES,@{@"code":response[@"code"]});
             } else {
                 NSLog(@"退出约会错误返回:%@",response[@"message"]);
                 [[DMCAlertCenter defaultCenter] postAlertWithMessage:response[@"message"]];
                 successBlock (NO,nil);
             }
         }
     }
                    failure:^(NSError *err)
     {
         
         NSLog(@"退出约会错误返回:%@",err.description);
         [[DMCAlertCenter defaultCenter] postAlertWithMessage:@"网络连接失败"];
         successBlock (NO,nil);
     }];
}

#pragma mark 图片上传接口
+ (void)uploadImageWithImage:(UIImage *)img
                   imgBelong:(NSString *)imgBelong
                successBlock:(void (^)(BOOL, NSDictionary *))successBlock {
    NSDictionary *params = @{@"belong":imgBelong,@"toAlbum":@"0"};
    NSData *imageData = UIImageJPEGRepresentation(img, 1);
    float length = [imageData length]/1000;
    float scale = 0.0f;
    if (length > 100) {
        scale = 100.0f /length;
        
    }else{
        scale = 1.0f;
    }
    
    NSData *fData = UIImageJPEGRepresentation(img, scale);
    NSURL* baseURL = [NSURL URLWithString:HttpUrlString];
    //获得请求管理者
    NSDictionary *newParams = [CodingTools signDataString:params];
    
    AFHTTPSessionManager* mgr = [[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];
    
    mgr.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json",@"text/javascript", @"text/plain", nil];
    [mgr     POST:@"common/uploadFile"
       parameters:newParams
constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData)
     {
         [formData appendPartWithFileData:fData name:@"file" fileName:@"image" mimeType:@"image/jpeg"];
     }
         progress:^(NSProgress * _Nonnull uploadProgress)
     {
         
     }
          success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject)
     {
         NSString *returnCode = [NSString stringWithFormat:@"%@",responseObject[@"code"]];
         if ([returnCode isEqualToString:@"ok"]) {
             NSLog(@"图片上传：%@",responseObject);
             successBlock(YES,responseObject);
         }else {
             NSLog(@"图片上传错误返回%@",responseObject[@"message"]);
             successBlock(NO,nil);
         }
         
     }
          failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error)
     {
         NSLog(@"图片上传失败%@",error.description);
         if (successBlock) {
             successBlock(NO,nil);
         }
     }];
    

}

@end



